/**
 *
 * Licensed Materials - Property of IBM 
 * 
 * OCO Source Materials 
 * 
 * (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved 
 * 
 * The source code for this program is not published or other- 
 * wise divested of its trade secrets, irrespective of what has 
 * been deposited with the U.S. Copyright Office. 
 *
 */

/**
 * CHANGE HiSTORY:
 * Author             Time                 Description
 *
 */
package com.ibm.ba.demo.entity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Configuration class for demo.properties
 * @author Luyi
 *
 */
@Component
public class SPSSModelConfiguration {
	@Value("${ws.username}")
	private String username;
	
	@Value("${ws.password}")
	private String password;
	
	@Value("${demo.spss.model}")
	private String spssModel;
	
	@Value("${demo.spss.model.udf}")
	private String spssModelUDF;
	
	@Value("${demo.spss.table}")
	private String spssTable;
	
	@Value("${demo.spss.prodField.prefix}")
	private String spssProductPrefix;
	
	@Value("${demo.spss.prodField.defaultValue}")
	private String spssProdDefaultValue;
	
	@Value("${demo.spss.prodField.true}")
	private String spssProdTrueValue;
	
	@Value("${demo.spss.custField}")
	private String custField;
	
	@Value("${demo.spss.custField.defaultValue}")
	private String custDefaultValue;
	
	@Value("${demo.productIds}")
	private String productIds;
	
	@Value("${demo.customerIds}")
	private String customerIds;
	
	public String getSpssModel() {
		return spssModel;
	}
	public void setSpssModel(String spssModel) {
		this.spssModel = spssModel;
	}
	
	public String getSpssModelUDF() {
		return spssModelUDF;
	}
	public void setSpssModelUDF(String spssModelUDF) {
		this.spssModelUDF = spssModelUDF;
	}
	
	public String getSpssTable() {
		return spssTable;
	}
	public void setSpssTable(String spssTable) {
		this.spssTable = spssTable;
	}
	public String getProductIds() {
		return productIds;
	}
	public void setProductIds(String productIds) {
		this.productIds = productIds;
	}
	public String getCustomerIds() {
		return customerIds;
	}
	public void setCustomerIds(String customerIds) {
		this.customerIds = customerIds;
	}
	public String getSpssProductPrefix() {
		return spssProductPrefix;
	}
	public void setSpssProductPrefix(String spssProductPrefix) {
		this.spssProductPrefix = spssProductPrefix;
	}
	
	public List<String> getStringList(String config) {
		if (config != null) {
			return Arrays.asList(config.split(","));
		} else {
			return null;
		}
	}
	
	public List<Integer> getIntegerList(String config){
		List<String> tempList = getStringList(config);
		List<Integer> resultList = new ArrayList<Integer>();
		if (tempList != null) {
			for (int i = 0; i < tempList.size(); i++) {
				resultList.add(Integer.parseInt(tempList.get(i)));
			}
			return resultList;
		} else {
			return null;
		}
	}
	public String getCustField() {
		return custField;
	}
	public void setCustField(String custField) {
		this.custField = custField;
	}
	public String getSpssProdDefaultValue() {
		return spssProdDefaultValue;
	}
	public void setSpssProdDefaultValue(String spssProdDefaultValue) {
		this.spssProdDefaultValue = spssProdDefaultValue;
	}
	public String getCustDefaultValue() {
		return custDefaultValue;
	}
	public void setCustDefaultValue(String custDefaultValue) {
		this.custDefaultValue = custDefaultValue;
	}
	public String getSpssProdTrueValue() {
		return spssProdTrueValue;
	}
	public void setSpssProdTrueValue(String spssProdTrueValue) {
		this.spssProdTrueValue = spssProdTrueValue;
	}
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}
